<?php

namespace app\common\validate;

use think\Validate;

class Vnsuser extends Validate
{
    // 验证规则
    protected $rule = [
        'username'  =>  'require|max:25',
        'mobile' => 'require|length:11|regex:/^[1][3456789][0-9]{9}$/',
        'group_id' => 'require',
        'password' => 'require',
        'username' => 'require',
        'pmobile' => 'require|require|length:11|regex:/^[1][345678][0-9]{9}$/',
        'ID_card_number' => 'require',
        'bank_name' => 'require',
        'bank_num' => 'require',
        // 'QQaccount' => 'require',
        // 'alipay' => 'require',
        // 'wechat' => 'require',
        // 's_pwd' => 'require',
        // 'from' => 'require|in:1,2,3,4',
        // 'to' => 'require|in:1,2,3,4',
        // 'num' => 'require',
    ];

    // 字段
    protected $field = [
        'username' => '用户名',
        'password' => '登录密码',
        // 's_pwd' => '支付密码',
        'mobile' => '手机号',
        'ID_card_number' => '身份证号',
        'bank_name' => '开户行',
        'bank_num' => '银行卡号',
        // 'province' => '所在省',
        // 'city' => '所在城市',
        // 'address' => '收货地址',
        // 'alipay' => '支付宝',
        // 'wechat' => '微信',
        'pmobile' => '推荐人手机号',
        // 'bank' => '银行卡名称',
    ];

    // 提示信息
    protected $message = [
        'mobile.regex' => '手机号码格式不正确',
        'pmobile.regex' => '手机格式不正确',
    ];
    
    // 场景
    protected $scene = [
        'addUser' => ['username', 'mobile', 'group_id', 'username', 'pmobile', 'QQaccount'],
        'cointrans' => ['s_pwd', 'num'],
        'cardId' => ['username','ID_card_number','bank_name','bank_num'],
        'mobile' => ['mobile']
    ];

}